<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vlinker云视频运营管理后台</title>
</head>
<link href="__PUBLIC__/css/bootstrap.css" rel="stylesheet">
<link href="__PUBLIC__/css/public.css" rel="stylesheet">
<link href="__PUBLIC__/css/font-awesome.css" rel="stylesheet">
<link href="__PUBLIC__/layui/css/layui.css" rel="stylesheet">
<link href="__PUBLIC__/css/user.css" rel="stylesheet">
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/public.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.all.js"></script>
<body>
    <!--头部-->
    <header>
        <div class="h_right">
            <img src="__PUBLIC__/images/top_right.png">
            <p>{$userinfo['username']}</p>
            <i class="icon-sort-down showUl"></i>
            <ul class="hideUl">
                <volist name="array1['areas']" id='row' key="k">
                <li><a href="javascript:;" data-json='{$row|json_encode}'>{$row['name']}</a></li>
                </volist>
                <li><a href="javascript:;" id="password">修改密码</a></li>
                <li><a href="{:U('login/logout')}">退出</a></li>
            </ul>
        </div>
        <div class="logo">
            <img src="__PUBLIC__/images/logo.png">
        </div>

        <div class="hk"></div>
        <div class="xg_password2 xg_password" >
            <div class="add_group_title">
                <img src="__PUBLIC__/images/i_guanbi.png" class="icon-remove">修改密码
            </div>
            <div class="add_group_center">
                <ul>
                    <li>
                        <span>
                            <i>*</i>原密码：
                        </span>
                        <input value="" name="oldpasswd"  type="password">
                    </li>
                    <li>
                        <span>
                            <i>*</i>新密码：
                        </span>
                        <input value=""  name="newpasswd"  type="password">
                    </li>
                    <li>
                        <span>
                            <i>*</i>确认密码：
                        </span>
                        <input value="" name="renewpasswd"  type="password">
                    </li>
                </ul>
            </div>
            <div class="add_group_btn">
                <button>确定</button>
                <button>取消</button>
            </div>
        </div>
    </header>
    <script type="text/javascript">
        $(function(){
            $('.hideUl li').not(':first,:last').on('click',function(){
                var _json = $(this).find('a').attr('data-json');
                _json = JSON.parse(_json);
                var areaid = _json.id;
                var areaname = _json.name;
                window.location.href = "/Index/index?areaid="+areaid+'&areaname='+areaname;
            })

            getPopup($('#password'),$('.xg_password'));
            $('.xg_password button').eq(0).on('click',function(){
                var renewpasswd = $('.xg_password input[name="renewpasswd"]').val();
                var _conf = {
                    oldpasswd:$('.xg_password input[name="oldpasswd"]').val(),
                    newpasswd:$('.xg_password input[name="newpasswd"]').val(),
                };
                var reg = /^\w{6,18}$/;
                for(var i in _conf){
                    if(!reg.test(_conf[i])){
                        layer.msg('密码由6-18位字母、数字、下划线组成',{icon:2,time:2000});
                        return false;
                    }
                }
                // 密码一致性
                if(_conf['newpasswd'] != renewpasswd){
                    layer.msg('确认密码和新密码不一致',{icon:2,time:2000});
                    return false;
                }
                $.post("{:U('forget_password/forget_password')}",_conf,function(data){
                    if(data.result == '0'){
                        layer.msg('修改密码成功',{icon:1,time:2000},function(){
                            close();
                        });
                    } else {
                        layer.msg(data.msg,{icon:2,time:2000});
                    }
                })
            })
        })
    </script>